'''
	Contains a Sphere geom.
	
	@author: J.H.Donker
	@copyright: Twente University
'''
import vtk
import wx

from wx.lib.pubsub import Publisher
from HeaDSETGeom import *

class HeaDSETSphere(HeaDSETGeom):
	
	#default properties
	#DEFSIZE = { 'radius': 0.50, 'resolution': 50 }
	
	#constructor
	def __init__(self, label = HeaDSETGeom.ELLIPSOID):
		'''
			This geom is a sphere. 
			
			@param label: The desired label. Defaults to HeaDSETGeom.ELLIPSOID.
		'''
		# create sphere source
		sphere = vtk.vtkSphereSource()
		sphere.SetRadius(self.DEFSIZE['radius'])
		sphere.SetThetaResolution(self.DEFSIZE['resolution'])
		sphere.SetPhiResolution(self.DEFSIZE['resolution'])
		
		# create poly mapper
		sphereMapper = vtk.vtkPolyDataMapper()
		sphereMapper.SetInput(sphere.GetOutput())
		
		# create actor
		actor = HeaDSETVTKActor()
		actor.SetMapper(sphereMapper)
		actor.SetGeom(self)
		
		# call super constructor
		HeaDSETGeom.__init__(self, actor, label)
		
	def TypeCopy(self):
		'''
			Returns a new HeaDSETSphere.
				
			@return: Fresh HeaDSETSphere.
		'''
		return HeaDSETSphere(self.GetLabel())
